/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author charliemalchow
 */

import java.sql.*;
import java.util.*;
import javax.swing.JOptionPane;

public class MatchProcessor {
    
    public double yearImportance = 0.2;
    public double bedtimeImportance = 0.4;
    public double neatnessImportance = 0.4;
    
    public MatchProcessor(double yearImportance, double bedtimeImportance, double neatnessImportance) {
        this.yearImportance = yearImportance;
        this.bedtimeImportance = bedtimeImportance;
        this.neatnessImportance = neatnessImportance;
    }
    
    public MatchProcessor() {
        //Construct
    }
    
    public double computeScore(Survey survey1, Survey survey2) {
        //Handle year
        int year1 = survey1.year;
        int year2 = survey2.year;
        double yearScore = Math.abs(year1 - year2) * yearImportance;
        
        //Handle bedtime
        int hour1 = survey1.bedtime.get(Calendar.HOUR_OF_DAY);
        int hour2 = survey2.bedtime.get(Calendar.HOUR_OF_DAY);
        double bedtimeScore = Math.abs(hour1 - hour2) * bedtimeImportance;
        
        //Handle neatness
        int neat1 = survey1.neatness;
        int neat2 = survey2.neatness;
        double neatnessScore = Math.abs(neat1 - neat2) * neatnessImportance;
        
        return yearScore + bedtimeScore + neatnessScore;
    }
}
